package com.whale.cloud.util.hbase.sql.client;

import com.whale.cloud.util.hbase.sql.entity.HResult;
import com.whale.cloud.util.hbase.sql.engine.HBaseSqlEngine;
import com.whale.cloud.util.hbase.sql.engine.impl.HBaseSqlEngineImpl;

import java.util.List;

/**
 * Created by linghf on 2016/9/2.
 */

public class HBTest {

    public static void main(String[] args) throws Exception {

//      System.setProperty("hadoop.home.dir", "F:\\big\\hadoop-2.6.2");
        HBaseSqlEngine sqlEngine = new HBaseSqlEngineImpl();
        String sql1 = "select * from user where _rowkey_ = 111";
        String sql2 = "select * from user where _rowkey_ in (111, 222)";
        String sql3 = "select * from user";
        String sql4 = "select _rowkey_ from user limit 5";
        String sql5 = "select _rowkey_,info.age from user where _startrow_ = 222 and _stoprow_ = 333";
        String sql6 = "insert into user (_rowkey_, info.name, info.age) values ('sdfdsfsd', 'fdsfsd', 12)";
        String sql7 = "SELECT basic.VIP_ID,basic.NAME_VIP FROM  BizvaneV2.VipProfile WHERE _rowkey_={\"CORP_ID\":C10016ˆ,ˆVIP_IDˆ:ˆ670441ˆ}";

//        sqlEngine.insert(sql6);


        List<HResult> result = sqlEngine.select(sql7);
        for (HResult r : result) {
            System.out.println(r);
        }

//        result = sqlEngine.select(sql4);
//        for (HResult r : result) {
//            System.out.println(r);
//        }
    }
}
